package com.yyk.yiliao.util;

import android.util.Log;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 时间转换器
 */

public class TimeUtil {
    public static final String ENG_DATE_FROMAT = "EEE, d MMM yyyy HH:mm:ss z";
    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
    public static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
    public static final String YYYY_MM_DD = "yyyy-MM-dd";
    public static final String YYYY_MM_DD_TEXT = "yyyy年MM月dd日";
    public static final String YYYY = "yyyy";
    public static final String MM = "MM";
    public static final String DD = "dd";
    public static final String MM_DD_HH_MM_TEXT = "MM月dd日 HH:mm";
    public static final String MM_DD_TEXT = "MM月dd日";

    public static final String HH_MM = "HH:mm";

    private static TimeUtil timeUtil;

    private TimeUtil() {

    }

    /**
     * 单例模式获取Dialog工具类
     *
     * @return
     */
    public static TimeUtil getInstance() {
        if (null == timeUtil) {
            timeUtil = new TimeUtil();
        }
        return timeUtil;
    }

    /**
     * 自己设置 日历类型，传入 时间戳和类型即可
     *
     * @param timeer
     * @return
     */
    public String getTime(int timeer, String type) {
        SimpleDateFormat format = new SimpleDateFormat(type);
        String time = format.format(new Date(Long.valueOf(timeer) * 1000L));
        Log.d("xxx-------->", "获取到的时间: " + timeer);
        Log.d("xxx-------->", "转换后时间: " + time);
        Log.d("xxx-------->", "转换后毫秒: " + (Long.valueOf(timeer) * 1000L));
        return time;
    }



}
